<template>

	<view class="content" style="margin-top: 40rpx;">
		
		<view class="box" v-for="(item,index) in list" :key="index">
				<image v-if="item.url" :src="item.url" @click="adJump(item)" mode="widthFix"></image>
		</view>
	</view>
</template>

<script>
	import {getScene} from "@/plugins/utils.js" 
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import {
		loGetLocation
	} from '@/config/common';
	export default {
	
		props:{
			
				list:{
				    type:Array,
				    default:[
					
					],
				},
			
			},
		computed: {
			...mapState(['PrimaryColor', `userInfo`]),
			freeSpecsButtonBackground() {
				return this.$u.colorToRgba(this.$u.rgbToHex(this.PrimaryColor), 0.75)
			},
		},
		data() {
			return {
			
			}
		},
		watch: {
			// //数据改变请求接口
			userInfo: {
				handler: function() {
					//请求接口
					if (this.userInfo.exhibitionBox && this.is_enabled) {
						this.activity_show = true
						this.getAddReceive()
						this.userInfo.exhibitionBox = false
						this.setUserInfo(this.userInfo)
					}
				},
				deep: true
			}

		},
		

	
		async onLoad(e) {
		
		},
	

		methods: {
	
		
		
		// 跳转
		adJump(item){
			if (this.userInfo.token) {
				// 小程序跳转
				if (item.href && item.type == 3) {
					this.onAdJump(item)
				}
				// 跳转H5
				if (item.href && item.type == 2) {
					this.onJump('/pages/webview/webview?url=' + encodeURI('' + item.href))
				}
				// 跳转视频
				if (item.href && item.type == 1) {
					this.videoLook(item.href)
				}
				if (item.href && item.type == 6) {
					this.onAdJump(item)
				}
			} else {
				this.judgePhone()
			}
		},
			
		videoLook(url){
			let src = Array.isArray(url)? url[0]:url;
			uni.$u.route('/pagesCircle/video/look', 
			  {src:src},
			);
		},
		onAdJump(obj){
			wx.vibrateShort();
			
			if(obj.type==3&&!obj.appid&&obj.href){
				// 跳转小程序内部
				uni.navigateTo({
					url: obj.href,
					fail: function(res) {
						
					    uni.reLaunch({
					    	url:obj.href
					    })
					  }
				})
			}
			if(obj.type==6&&!obj.appid&&obj.href){
				// 跳转小程序内部
				uni.navigateTo({
					url: obj.href,
					fail: function(res) {
						
					    uni.reLaunch({
					    	url:obj.href
					    })
					  }
				})
			}
			
			// 外部小程序跳转
			if(obj.type==3&&obj.appid&&obj.href){
				// 跳转小程序内部
				
				uni.navigateToMiniProgram({
				    appId:obj.appid,
				    path:obj.href,
				    envVersion:"release",
				    success: res => {
				   
				    },
				    fail: err => {
				     
				    }
				});
			}
			
		},
		
		
		
	
	},
}
</script>

<style lang="scss" scoped>
.box{
	width: 100%;
	display: flex;
	image{
		width: 100%;
	}
}
.content{
	// background-color: #fff;
}
</style>